package cn.iocoder.yudao.module.erp.dal.mysql.stocksmoveitem;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.erp.dal.dataobject.stocksmoveitem.StocksMoveItemDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.erp.controller.admin.stocksmoveitem.vo.*;

/**
 * ERP 库存调拨项 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface StocksMoveItemMapper extends BaseMapperX<StocksMoveItemDO> {

    default PageResult<StocksMoveItemDO> selectPage(StocksMoveItemPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<StocksMoveItemDO>()
                .eqIfPresent(StocksMoveItemDO::getMoveId, reqVO.getMoveId())
                .eqIfPresent(StocksMoveItemDO::getProductId, reqVO.getProductId())
                .eqIfPresent(StocksMoveItemDO::getProductUnit, reqVO.getProductUnit())
                .eqIfPresent(StocksMoveItemDO::getProductStandards, reqVO.getProductStandards())
                .eqIfPresent(StocksMoveItemDO::getProductPrice, reqVO.getProductPrice())
                .eqIfPresent(StocksMoveItemDO::getProductBatch, reqVO.getProductBatch())
                .betweenIfPresent(StocksMoveItemDO::getProductValidityDate, reqVO.getProductValidityDate())
                .eqIfPresent(StocksMoveItemDO::getCount, reqVO.getCount())
                .eqIfPresent(StocksMoveItemDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(StocksMoveItemDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(StocksMoveItemDO::getId));
    }
    default List<StocksMoveItemDO> selectListByMoveId(Long moveId) {
        return selectList(StocksMoveItemDO::getMoveId, moveId);
    }

    default int deleteByMoveId(Long moveId) {
        return delete(StocksMoveItemDO::getMoveId, moveId);
    }

}